<?php
/**********************************************************************
 *                                                                    *    
 * Copyright (c) 2009 Dmytro Bezhnar. All rights reserved.     *
 *                                                                    *
 **********************************************************************/

/**
 * Ageset entity manager.
 *
 * @version $Id: StopManager_old.php,v 1.2 2008/08/15 07:24:49 agvin Exp $
 */
class StopManager_old extends ORMManager
{

	function checkWordAccess($text){
		global $options;
		$stop_count = 0;
		$qs = "SELECT * FROM ".$options['passport']['database'].".stop_word";
		$stop_list = $this->getArray($qs);
		foreach ($stop_list as $item){
			if (preg_match('%'.$item['word'].'%', $text)){
				$stop_count++;
				func_log($item['word_id'],'STOP_WORDS_LOG', LOG_ERR);
			}
		}
		return $stop_count;
	}
	
	function checkIPAccess($ip)	{
		global $options;
		$qs = "SELECT * FROM ".$options['passport']['database'].".stop_ip WHERE ip=".$ip;
		$stop_ip = $this->getOneArray($qs);
		if (count($stop_ip)) return true;
		return false;
	}
	
	function getIpID($data)	{
		global $options;
		$qs="SELECT * FROM ".$options['passport']['database'].".ip_list WHERE coockies='".$data."'";
		$ip_id=$this->getOneArray($qs);
		return $ip_id['list_id'];
	}
	
	function insertIpID($data){
		$ip_list = new Ip_listDB();
		$ip_list->ip = REMOTE_ADDR;
		$ip_list->check_not_array=array('date');
		$ip_list->date = 'NOW()';
		$ip_list->coockies = $data;
		$this->insert($ip_list);
		return $ip_list->list_id;
	}

}
?>